//
//  AppNavgiationController.m
//  EnterpriseManagement
//
//  Created by Lwx on 16/10/28.
//  Copyright © 2016年 Lwx. All rights reserved.
//

#import "AppNavgiationController.h"


@interface AppNavgiationController ()

@end

@implementation AppNavgiationController

+ (void)initialize
{
    UINavigationBar *navBar = [UINavigationBar appearance];
    [navBar setTintColor:[UIColor themeColor]];
    [navBar setBarTintColor:[UIColor whiteColor]];
    [navBar setTranslucent:NO];
//    [navBar setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
//    [navBar setShadowImage:[[UIImage alloc]init]];
    
    [navBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17.0f],NSForegroundColorAttributeName:[UIColor themeColor]}];
    
//    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMax, NSIntegerMax) forBarMetrics:UIBarMetricsDefault];

    // 改变左右buttonItem样式
    NSDictionary* normalAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                      [UIColor whiteColor],NSForegroundColorAttributeName,
                                      [UIFont systemFontOfSize:14],NSFontAttributeName,
                                      nil];
    
    [[UIBarButtonItem appearance] setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return  UIStatusBarStyleDefault;//UIStatusBarStyleLightContent;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
    backItem.title = @"";
    viewController.navigationItem.backBarButtonItem = backItem;
    if (self.viewControllers.count > 0)
    {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:YES];
}

@end
